<template>
    <div class="newInfo">
        <div v-for="item in newInfo" :key="item.id">
            <h4>{{item.title}}</h4>
            <p class="mui-media-body">
                <span>发表时间：{{item.add_time | dateFormat}}</span>
                <span>点击：{{item.click}}</span>
            </p>
            <hr>
            <div v-html="item.content"></div>
        </div>
        <comment-box v-bind:artid="id"></comment-box>
    </div>
</template>
<script>
import comment from '../../subcomponent/comment.vue'
export default {
    data() {
        return {
            id:this.$route.params.id,
            newInfo:{}
        }
    },
    created() {
        this.getNewInfo()
    },
    methods: {
        getNewInfo(){
            this.$http.get('http://www.liulongbin.top:3005/api/getnew/'+ this.id)
            .then(res => {
                if (res.data.status == 0) {
                    this.newInfo = res.data.message;
                    // console.log(res.data.message);
                }
        })
        .catch(function(error) {
          // handle error
           Toast("获取新闻列表失败");
        });
        }
    },

    components:{
        'comment-box':comment
    }
}
</script>
<style lang="less" scoped>
    .newInfo{
        h4{
            font-size: 15px;
        }
       .mui-media-body{
           margin-bottom: 0;
           display: flex;
           justify-content: space-between;
           color: #26a2ff;
       }
       hr{
           margin: 3px 0;
       }
    }
</style>